#ifndef SETTINGS_HPP
#define SETTINGS_HPP

#include <map>
#include <fstream>
#include <deque>

#include <GlobalDefines.hpp>

class Settings
{
public:
  static Settings& Load(std::string filename);

  bool IsEmpty();

  bool Save();

  std::string Filename();

  bool Contains(std::string key);

  bool        GetBool   (std::string key, bool        defaultValue = false);

  int         GetInt    (std::string key, int         defaultValue = 0);

  double      GetDouble (std::string key, double      defaultValue = 0.0);

  std::string GetString (std::string key, std::string defaultValue = "");

  void SetBool   (std::string key, bool        value);

  void SetInt    (std::string key, int         value);

  void SetDouble (std::string key, double      value);

  void SetString (std::string key, std::string value);

private:
  // Functions

  static std::string EliminateWhitespace(std::string in);

  Settings(std::string filename); // private constructor

  //Settings(Settings& otherSettings);

  //const Settings& operator = (const Settings& otherSettings);

  bool LoadFile(std::string filename);

  // Variables

  static std::deque<Settings*> settingsList;

  std::string filename;

  std::map<std::string, bool>        boolSettings;

  std::map<std::string, int>         intSettings;

  std::map<std::string, double>      doubleSettings;

  std::map<std::string, std::string> stringSettings;
};

#endif
